package com.zyf.project.kvdb.protocol.proto;

import com.zyf.project.binaryproto.annotation.DataContract;
import com.zyf.project.binaryproto.annotation.DataField;
import com.zyf.project.binaryproto.type.PrimitiveType;
import com.zyf.project.kvdb.protocol.constants.Constants;

/**
 * <h1>KVDB 消息封装</h1>
 *
 * @author Zhou Yifan
 */
@DataContract(code = Constants.MESSAGE)
public interface Message {

    /**
     * 获取消息 ID
     *
     * @return Long 值，键值对操作类型为 {@link PrimitiveType#INT64}
     */
    @DataField(order = 0, primitiveType = PrimitiveType.INT64)
    Long getId();

    /**
     * 消息体，设置为可嵌套的键值数据类型
     *
     * @return {@link MessageContent}
     */
    @DataField(order = 2, refContract = true, genericContract = true)
    MessageContent getContent();

}
